<template>
<view class="w-100 re h-100">
	<scroll-view class="scroll-view_H uni-scroll" scroll-y="true" @scrolltolower="lower" :lower-threshold="200">
		<view class="w-100 px-3 py-2">
			<view class="w-100 h222 f-b-c circle34 show0 mb-3 bg-f8ff ov-hd re" v-for="(item,index) in data_list" :key="item.id">
				<ImgFile :url="item.thumbnail" className="w246 h222 ab top0 left0 z-99"></ImgFile>
				<view></view>
				<view class="w490 bg-white h222 p-3 ty-circle-box re z-999 right0">
					<view class="font32 t-20 font700 f-b-c h32">{{item.name}}</view>
					<view class="font24 t-8 f-b-c h24" style="margin-top: 16rpx;">{{item.purchaseNote}}</view>
					<view class="ab right30 bottom30 w164 h64 f-c-c font28 t-0 circle20 bg-theme" @click="get_details(item)">查看详情</view>
					<HornMargin type="left-bottom" :width="44" :height="40" />
				</view>
			</view>
			<view class="w-100 h200"></view>
		</view>
	</scroll-view>
</view>
</template>

<script>
	import HornMargin from "../../components/horn_margin.vue"
	import ImgFile from "../../components/img_file.vue"
	import {activityList} from "../../api/ticket/index.js"
	import Mixin from "../../common/mixin.js"
    export default {
		mixins:[Mixin],
		components:{HornMargin,ImgFile},
        data() {
            return {
                query:{
                	pageSize:12,
                	currentPage:1,
					type:"COURSE", // 类型 活动:ACTIVITY/课程:COURSE/会员专属：VIP_EXCLUSIVE,
                },
                is_loading:false,
                data_list:[],
            };
        },
		created(){
			this.get_data_list()
		},
        methods: {
			get_data_list(){
				activityList(this.query).then(res=>{
					const {records, current, pages} = res.body
					this.data_list = [...this.data_list,...records]
					// 当前页大于总页 显示没有更多了 
					if(current >= pages){
						this.is_loading = true
					}else{
						this.is_loading = false
					}
				})
			},
			get_details(val){
				uni.setStorageSync("details",val)
				uni.navigateTo({
					url:"/pages/ticket/course/details"
				})
			}
		},

    };
</script>

<style scoped="scoped" lang="scss">
	.scroll-view_H{
		position: absolute;
		top: 30rpx;
		left: 0;
		bottom: 0;
		right: 0;
		z-index: 9;
	}
	.ty-circle-box{
		border-radius: 34rpx 0 0 0;
	}
</style>